package com.shaoshaohuo.app.utils;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TabWidget;
import android.widget.TextView;

import com.shaoshaohuo.app.R;

public class ViewHelper {

	
//	public static LoadingDialog getLoadingDialog(Context context,String loadingText,boolean cancelable, boolean outeSiteCanceled) {
//	    LoadingDialog dialog = new LoadingDialog(context);
//	    if (!StringHelper.invalidString(loadingText)) {
//		    dialog.setLoadText(loadingText);
//		}
//	    dialog.setCanceledOnTouchOutside(outeSiteCanceled);
//	    dialog.setCancelable(cancelable);
//	    return dialog;
//    }
	
	public static  void setListVIewEmptyView(Context context,ListView listview) {
		ViewGroup parentView = (ViewGroup) listview.getParent();  
		View emptyView = parentView.findViewById(R.id.layout_empty);
		listview.setEmptyView(emptyView);
	}

	public static void setTabHostStyle(TabWidget tabWidget, Context context, int selectedIndex) {
		if (tabWidget == null) {
			return;
		}
		for (int i =0; i < tabWidget.getChildCount(); i++) {
			float height = 42.24f;//88px
			View tab = tabWidget.getChildAt(i);
			tab.getLayoutParams().height = ViewUtil.dip2px(context, height);
			TextView tv = (TextView) tab.findViewById(android.R.id.title);
			float textSize = 13.44f;//28px
			tv.setTextSize(textSize);
			if (i == selectedIndex) {
				tv.setTextColor(context.getResources().getColor(R.color.color_77C755));
				tab.setBackgroundResource(R.drawable.bg_tab_view);
			} else {
				tv.setTextColor(context.getResources().getColor(android.R.color.black));
				tab.setBackgroundResource(R.drawable.bg_tab_view_default);
			}
		}
	}
}
